import { computed, ref } from "vue";

import { FormRowType, TDFormType } from "@/libs/components/dynamicForm";
import { useResettableRef } from "@/libs/hooks";

const typeOptions = [
  { label: "计算机学院", value: "1" },
  { label: "软件学院", value: "2" },
  { label: "物联网学院", value: "3" },
];
const yearOptions = [
  { label: "2020", value: "2020" },
  { label: "2021", value: "2021" },
  { label: "2022", value: "2022" },
  { label: "2023", value: "2023" },
  { label: "2024", value: "2024" },
  { label: "2025", value: "2025" },
  { label: "2026", value: "2026" },
];
const depOptions = [
  { label: "软件工程", value: "1" },
  { label: "计算机科学与技术", value: "2" },
  { label: "物联网工程", value: "3" },
];
export const formRef = ref(null);

export const formAttribute = ref<TDFormType>({
  disabled: false,
  labelWidth: "0px",
});

export const [formData, resetFormData] = useResettableRef({
  bookNumber: "",
  title: "",
  card: "",
});
// {
//   name: "type",
//     colAttribute: {
//   span: 3,
// },
//   component: "Input",
//     componentAttribute: {
//   options: typeOptions,
//     placeholder: "请选择获奖类型",
// },
//   formItemAttribute: {
//     label: "",
//   },
// },

// {
//   name: "year",
//     colAttribute: {
//   span: 3,
// },
//   component: "Select",
//     componentAttribute: {
//   options: yearOptions,
//     placeholder: "请选择获奖年份",
// },
//   formItemAttribute: {
//     label: "",
//   },
// },
export const formItems = computed<FormRowType[]>(() => [
  {
    children: [
      {
        name: "title",
        colAttribute: {
          span: 3,
        },
        component: "Input",
        componentAttribute: {
          options: typeOptions,
          placeholder: "姓名",
        },
        formItemAttribute: {
          label: "",
        },
      },
      {
        name: "card",
        colAttribute: {
          span: 3,
        },
        component: "Input",
        componentAttribute: {
          placeholder: "证件号码",
        },
        formItemAttribute: {
          label: "",
        },
      },
      {
        name: "bookNumber",
        colAttribute: {
          span: 3,
        },
        component: "Input",
        componentAttribute: {
          placeholder: "证书编号",
        },
        formItemAttribute: {
          label: "",
        },
      },
    ],
  },
]);
